import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/home/index.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "home",
    component: HomeView,
  },
  {
    path: "/about",
    name: "about",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
  },
  {
    path: "/all-boxes",
    name: "allBoxes",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/all-boxes/index.vue"),
  },
  {
    path: "/faq",
    name: "faq",
    component: () => import("../views/faq/index.vue"),
  },
  {
    path: "/user-center",
    name: "user-center",
    component: () => import("../views/user-center/index.vue"),
    redirect: "/user-center/account",
    children: [
      {
        path: "account",
        name: "account",
        component: () => import("../views/user-center/account/index.vue"),
      },
      {
        path: "inventory",
        name: "inventory",
        component: () => import("../views/user-center/inventory/index.vue"),
      },
      {
        path: "trade-history",
        name: "trade-history",
        component: () => import("../views/user-center/trade-history"),
      },
      {
        path: "delivery-record",
        name: "delivery-record",
        component: () => import("../views/user-center/delivery-record"),
      },
    ],
  },
  {
    path: "/my-refer",
    name: "my-refer",
    component: () => import("../views/my-refer/index.vue"),
  },
  {
    path: "/sign-in",
    name: "sign-in",
    component: () => import("../views/sign-in/index.vue"),
  },
  {
    path: "/sign-up",
    name: "sign-up",
    component: () => import("../views/sign-up/index.vue"),
  },
  {
    path: "/forgot-password",
    name: "forgot-password",
    component: () => import("../views/forgot-password/index.vue"),
  },
  {
    path: "/roll",
    name: "roll",
    component: () => import("../views/roll/index.vue"),
  },
  {
    path: "/download",
    name: "download",
    component: () => import("../views/download/index.vue"),
    redirect: "/download/ios",
    children: [
      {
        path: "ios",
        name: "ios",
        component: () => import("../views/download/ios/index.vue"),
      },
      {
        path: "android",
        name: "android",
        component: () => import("../views/download/android/index.vue"),
      },
    ],
  },
  {
    path: "/store",
    name: "store",
    component: () => import("../views/store/index.vue"),
  },
  {
    path: "/product",
    name: "product",
    component: () => import("../views/product/index.vue"),
  },
  {
    path: "/test",
    name: "product",
    component: () => import("../views/test/index.vue"),
  },
  {
    path: "/box",
    name: "box",
    component: () => import("../views/box/index.vue"),
  },
  {
    path: "/notifications",
    name: "notifications",
    component: () => import("../views/notifications/index.vue"),
  },
];

const router = new VueRouter({
  routes,
});

export default router;
